<?php
$model = new ClassStructures;
$class_course_id = ($type == 'course') ? 'courses_id' : 'classes_id';
$classcoursebatchid = ($type == 'course') ? 'course_batche_id' : 'class_batch_id';
$structure = $model->findAllByAttributes(array($class_course_id => $classId, $classcoursebatchid => $batchId));
$structIndex = '';
?>
<div id="venue_<?php echo $venueIndex; ?>_batch_<?php echo $batchIndex; ?>_classStructures">
    <?php if (count($structure) > 0) { ?>
        <?php for ($structIndex = 0; $structIndex < count($structure); $structIndex++) { ?>     
            <div id="remove_class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $structIndex; ?>" class="classStructureControl">        
                <div class="form-group">  
                    <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3">
                        <?php echo $form->labelEx($model, 'start_time'); ?>
                        <div class="input-append bootstrap-timepicker time-sin input-group input-group-lg">
                            <input  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][start_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_start_time_<?php echo $structIndex; ?>" type="text" class="add-on book-control time-sin"  placeholder="0"  maxlength="3" value="<?php echo $structure[$structIndex]->start_time; ?>" readonly="readonly">
                            <span class="input-group-addon">Min</span>
                        </div>
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3">
                        <?php echo $form->labelEx($model, 'end_time'); ?>
                        <div class="input-append bootstrap-timepicker time-sin time-sin input-group input-group-lg">
                            <input type="hidden" name="addclassStructure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_count_<?php echo $structIndex; ?>" value="<?php echo $structIndex; ?>" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_startDatecount add-on book-control time-sin">
                            <input onkeypress="return isNumberKey(event)"  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][end_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_end_time_<?php echo $structIndex; ?>" type="text" class="add-on book-control time-sin"  maxlength="2" onblur="addValueInclassStructureStartTime(this.id)" value="<?php echo $structure[$structIndex]->end_time; ?>">
                            <span class="input-group-addon">Min</span>
                        </div>
                    </div>
                </div>
                <div class="form-group">  
                    <div class="col-lg-12 col-md-12 col-sm-12 column12 course-pdlr">
                        <?php echo $form->labelEx($model, 'description'); ?>
                        <textarea class="form-control book-control" name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][description][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_description_<?php echo $structIndex; ?>"><?php echo $structure[$structIndex]->description; ?></textarea>
                    </div>
                </div>
                <?php if ($structIndex > 0) { ?>
                    <div class="form-group">
                        <div class="col-lg-3 col-md-3 col-sm-3 column3 add-struct course-pdl">
                            <a href="javascript:void(0)" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $batchIndex; ?>" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $structIndex; ?>" onclick="removeclassStructures(this.id);">-Remove</a>
                        </div>
                    </div>
                <?php } ?></div>
            <?php
        }
    } else {
        ?><div class="form-group">  
            <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3">
                <?php echo $form->labelEx($model, 'start_time'); ?>
                <div class="input-append bootstrap-timepicker time-sin input-group input-group-lg">
                    <input  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][start_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_start_time_0" type="text" class="add-on book-control time-sin"  placeholder="0"  maxlength="3"  readonly="readonly">
                    <span class="input-group-addon">Min</span>
                </div>
            </div>
            <div class="col-lg-3 col-md-3 col-sm-3 course-pdl column3">
                <?php echo $form->labelEx($model, 'end_time'); ?>
                <div class="input-append bootstrap-timepicker time-sin time-sin input-group input-group-lg">
                    <input type="hidden" name="addclassStructure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_count_0" value="0" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_startDatecount add-on book-control time-sin">
                    <input onkeypress="return isNumberKey(event)"  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][end_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_end_time_0" type="text" class="add-on book-control time-sin"  maxlength="2" onblur="addValueInclassStructureStartTime(this.id)" >
                    <span class="input-group-addon">Min</span>
                </div>
            </div>
        </div>
        <div class="form-group">  
            <div class="col-lg-12 col-md-12 col-sm-12 column12 course-pdlr">
                <?php echo $form->labelEx($model, 'description'); ?>
                <textarea class="form-control book-control" name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][description][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_description_0"></textarea>
            </div>
        </div>
    <?php }
    ?>
</div> 
<div class="clearfix"></div>
<div class="form-group">
    <div class="col-lg-3 col-md-3 col-sm-3 column3 add-struct course-pdl">
        <a href="javascript:void(0)" class="btn-green lass_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_add_structure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_add_count_<?php echo ($structIndex == '') ? '0' : $structIndex - 1; ?>" onclick="addclassStructures(this.id);">Add Structures</a>
    </div>
</div>
